hive -e set hive.cbo.enable=false;
set hive.execution.engine=mr;
insert overwrite table edu.dwd_traffic_error_inc partition(dt='2022-02-21')
select
    province_id,
    brand,
    channel,
    is_new,
    model,
    mid_id,
    operate_system,
    user_id,
       sc,
    version_code,
    page_item,
    page_item_type,
    last_page_id,
    page_id,
    source_type,
    entry,
    loading_time,
    open_ad_id,
    open_ad_ms,
    open_ad_skip_ms,
    actions,
    displays,
    date_format(from_utc_timestamp(ts,'GMT+8'),'yyyy-MM-dd') date_id,
    date_format(from_utc_timestamp(ts,'GMT+8'),'yyyy-MM-dd HH:mm:ss') error_time,
    error_code,
    error_msg
from
(
    select
        common.ar area_code,
        common.ba brand,
        common.ch channel,
        common.is_new,
        common.md model,
        common.mid mid_id,
        common.os operate_system,
        common.uid user_id,
        common.vc version_code,
           common.sc,
        page.during_time,
        page.item page_item,
        page.item_type page_item_type,
        page.last_page_id,
        page.page_id,
        page.source_type,
        /`start/`.entry,
        /`start/`.loading_time,
        /`start/`.open_ad_id,
        /`start/`.open_ad_ms,
        /`start/`.open_ad_skip_ms,
        actions,
        displays,
        err.error_code,
        err.msg error_msg,
        ts
    from edu.ods_log_inc
    where dt='2022-02-21'
    and err is not null
)log
left join
(
    select
        id province_id,
        area_code
    from edu.ods_base_province_full
    where dt='2022-02-21'
)bp
on log.area_code=bp.province_id;
